    <%--
      Created by IntelliJ IDEA.
      User: Lenovo
      Date: 2025/5/4
      Time: 17:51
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
    <%@ page import="com.project.DB_Airline" %>
    <%@ page import="java.util.ArrayList" %>
    <%@ page import="java.util.List" %>
    <%
        // 获取表单数据
        String fid = request.getParameter("fid");
        String dateYear = request.getParameter("dateYear");
        String dateMonth = request.getParameter("dateMonth");
        String dateDay = request.getParameter("dateDay");
        String position = request.getParameter("position");
        String remain = request.getParameter("remain");

        // 拼接日期
        String date = dateYear + "-" + dateMonth + "-" + dateDay;

        // 构建添加操作的输入列表
        List<String> addInput = new ArrayList<>();
        addInput.add(fid);
        addInput.add(date);
        addInput.add(position);
        addInput.add(remain);

        // 创建 DB_Airline 实例
        DB_Airline dbAirline = new DB_Airline();
        // 执行添加操作
        boolean addResult = dbAirline.add(addInput);

        if (addResult) {
            // 添加成功，重定向到 index.jsp
            response.sendRedirect("index.jsp");
        } else {
            // 添加失败，输出错误信息
            out.print("添加航线失败，请检查输入信息或联系管理员");
        }
    %>